package com.ge.energy.pgs.myfleet.code.factory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.ge.energy.pgs.myfleet.code.vo.ChatRoomInfo;
import com.ge.energy.pgs.myfleet.code.vo.ChatRoomMessage;
import com.ge.energy.pgs.myfleet.code.vo.Contact;
import com.ge.energy.pgs.myfleet.database.data.DataInitBean;
import com.ge.energy.pgs.myfleet.database.table.RoomTable;

public class ChatRoomFactory {
	private static Map<String,ChatRoomInfo> chatRooms;
	public void initChatRoomFactory(){
		ChatRoomFactory.chatRooms = new HashMap<String,ChatRoomInfo>();
		for(RoomTable room : DataInitBean.roomTable){
			ChatRoomInfo info = new ChatRoomInfo();
			info.setName(room.getChatRoomName());
			info.setId(room.getChatRoomId());
			info.setDescription(room.getChatRoomDec());
			info.setChatRoomContacts(new HashMap<String,Contact>());
			info.setChatRoomMessages(new ArrayList<ChatRoomMessage>());
			chatRooms.put(room.getChatRoomId(), info);
		}
	}
	public  static synchronized Map<String,ChatRoomInfo> getChatRooms(){
		return ChatRoomFactory.chatRooms;
	}
}
